package com.steak.spring.value;

import org.springframework.beans.PropertyValue;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.env.MapPropertySource;

import java.util.HashMap;

/**
 * @author 刘牌
 * @Title:
 * @date 2022-03-2918:19
 */
public class ValueTest {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        HashMap<String, Object> map = new HashMap<>();
        map.put("girl.username","fanfan");
        map.put("girl.height",170);
        map.put("girl.weight",55);
        map.put("girl.age",45);
        MapPropertySource girlProperties = new MapPropertySource("girl", map);
        context.getEnvironment().getPropertySources().addFirst(girlProperties);
        context.register(BeanConfiguration.class);
        context.refresh();
        Girl bean = context.getBean(Girl.class);
        System.out.println(bean);
    }
}
